package com.retail.system.service.impl;

import com.retail.core.entity.ParamReq;
import com.retail.system.entity.request.LogRequest;
import com.retail.system.entity.vo.LogVo;
import com.retail.system.mapper.LogMapper;
import com.retail.system.service.LogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 日志管理 Service impl
 *
 * @author Administrator
 */
@Service
public class LogServiceImpl implements LogService {

    @Resource
    private LogMapper logMapper;

    @Override
    public LogVo getModel(Long id) {
        return logMapper.getModel(id);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Long save(LogRequest request) {
        logMapper.save(request);
        return request.getId();
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Long update(LogRequest request) {
         logMapper.update(request);
         return request.getId();
    }

    @Override
    public List<LogVo> listPage(ParamReq<LogRequest> params) {
        List<LogVo> pos = logMapper.listPage(params);
        return pos;
    }

    @Override
    public Integer countPage(ParamReq<LogRequest> params) {
        return logMapper.countPage(params);
    }

    @Override
    public Integer updateDelFlagById(Long id, Integer delFlag) {
        return logMapper.updateDelFlagById(id, delFlag);
    }

}
